import MessageChain from '../class/MessageChain.js';
import extentContext from '../context.js';


let defaultChain = extentContext().MESSAGE_CHAIN = extentContext().MESSAGE_CHAIN || {};
var emitter = new MessageChain({
  chain: defaultChain,
  registerHandler(config, remove){
    if (config.vue){
      let bum = config.vue.bum = config.vue.bum || [];
      bum.push(remove);
    }
  }
});

export default emitter;

export let emitterInstall = {
  install(vue){
    vue.config.globalProperties.$emitter = emitter;
  }
};
